GBML manual / Collision

mask_y

How far below this instance’s own `y` the collision box sits, in pixels (negative is up). 0 (the default) centers it on the instance.

Syntax

mask_y: int

Description

How far below this instance's own y its collision box sits, in pixels. Negative moves it up. 0, the default, centers the box on the instance.

Positive is down, matching the screen and matching depth - not direction, whose angles are measured the other way because they are angles, not places.

Example

mask_h = 10;
mask_y = 11;

The feet of a character drawn 32 pixels tall: a short box near the bottom of the sprite rather than one centered on their chest.

Why a character usually wants this

A top-down game reads better when the thing that bumps into walls is roughly where the character's feet are. Their head passing over a wall's top edge looks like depth; their waist stopping against it looks like a bug.

Without an offset, a shorter mask can only ever sit in the middle of the art, so "smaller box" and "box in the right place" were the same setting, and you could only have one of them.

What moves, and what does not

The offset moves the rectangle. It does not move the instance, its sprite, or anything that reads y.

Everything that asks about the rectangle sees the moved one - collides, pos_free, the collision_* queries, and move_slide as it walks along a wall, which is the case that matters most: the offset box is what meets the wall, so a feet-only mask really does stop at the wall its feet are touching.

box_top and box_bottom read the moved rectangle back in room coordinates, which is the pair to reach for when you want to know where the box actually is rather than where it was offset to.

On the GBA

Positive is DOWN - the screen’s own convention, like `depth`, not `direction`’s maths-space one. A small box offset downward is how a tall character collides on its feet rather than through its middle; with no offset a smaller mask can only ever sit at the sprite’s center.

See also: mask_xmask_wmask_hbox_topmove_slide